package com.chenxin.common.core.domain;

import lombok.Data;

import java.io.Serializable;

/**
 * 接口过程返回结果
 */
@Data
public class ApiResult implements Serializable {
    private static final long serialVersionUID = 1L;

    private String code;
    private String message;
    private String data;

    public ApiResult(String code, String message, String data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static ApiResult success(String message, String data) {
        return new ApiResult("0", message, data);
    }

    public static ApiResult error(String message, String data) {
        return new ApiResult("1", message, data);
    }

    public static ApiResult error(String code, String message, String data) {
        return new ApiResult(code, message, data);
    }
}
